import { ApiProperty } from '@nestjs/swagger'
import { IsEnum, IsNotEmpty, IsOptional, IsString } from 'class-validator'
import { TRoleStatus } from '@/enum/commom.emun'

export class CreateRoleDto {
  @ApiProperty({
    description: '角色名称',
  })
  @IsNotEmpty({
    message: '菜单类型不能为空',
  })
  @IsString({ message: '角色编码必须是字符串' })
  roleName: string

  @ApiProperty({ description: '角色编码', example: 'Admin' })
  @IsNotEmpty({
    message: '角色编码不能为空',
  })
  @IsString({ message: '角色编码必须是字符串' })
  roleCode: string

  @ApiProperty({ description: '角色状态', enum: TRoleStatus, default: TRoleStatus.enable })
  @IsNotEmpty({
    message: '角色状态不能为空',
  })
  @IsEnum(TRoleStatus, { message: '角色状态不合法' })
  status: TRoleStatus

  @ApiProperty({ description: '角色描述', example: '管理员', required: false })
  @IsOptional()
  roleDesc: string
}
